home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacAddict 100
/
MacAddict_100_2004_12.iso
/
mac
/
Files from the Print Side
/
Script Folder Actions
/
sample_script.txt
< prev
Wrap
Text File
|
2004-10-06
|
2KB
|
42 lines
on adding folder items to this_folder after receiving these_items
tell application "Finder"
tell application "Finder"
set the_date to current date
set wd to weekday of the_date as string
set m to month of the_date as string
set d to day of the_date as string
set ts to time of the_date as string
set sent_folder to wd & m & d & "-" & ts as string
end tell
if not (exists folder sent_folder of folder "Desktop" of home) then
make new folder at folder "Desktop" of home with properties {name:sent_folder}
end if
set the destination_folder to folder sent_folder of folder "Desktop" of home as alias
set the destination_directory to POSIX path of the destination_folder
end tell
repeat with i from 1 to number of items in these_items
set this_item to item i of these_items
set the item_info to info for this_item
if this_item is not the destination_folder and the name extension of the item_info is not in {"zip", "sit"} then
set the item_path to the quoted form of the POSIX path of this_item
set the destination_path to the quoted form of (destination_directory & (name of the item_info) & ".zip")
do shell script ("/usr/bin/ditto -c -k -rsrc --keepParent " & item_path & " " & destination_path)
end if
end repeat
tell application "Finder"
tell application "Mail"
activate
set newmessage to make new outgoing message at beginning of outgoing messages
tell content of newmessage
make attachment at end of attachments with properties {file name:destination_directory}
set visible of newmessage to true
end tell
end tell
tell application "Finder"
move folder sent_folder of folder "Desktop" of home to trash
end tell
end tell
end adding folder items to